const clear = [
  /    /g,
  /\(看小说.*\)|16977小游戏每天更新好玩的小游戏，等你来发现！/g,
  /为了方便您阅读，请记住“网”网址:\/|\$|www.*com|\(~~~.*~~~\)/g,
  /电.*?脑.*?手.*?打|(全文}字|本书整.*理).*?o~o|电脑.*?n.et/g,
  /手打更新！/g,
  /\(药神手打想念你曾经\)/g,
  /{红花手打组奉献}/g,
  /囦/g,
  /手机阅读请访问wap,手机小说更新最快/g,
  '请记住【笔趣阁 m.biqugeso.com】，第一时间更新，无弹窗，免费读！',
  /百度搜索“biquge.jp”/g,
  /={cid:"",aid:"1o36"};/g,
  /[《`+-=\\]*顶.?点.?小.?说[《`+-=\\a-z.]*/g
];

const replace = [
  ['1ang', '浪'],
  ['1uan', '乱'],
  ['bō', '波'],
  ['bo', '勃'],
  ['bī', '逼'],
  ['bi', '逼'],
  ['chuang', '床'],
  ['cháo', '潮'],
  ['chao', '潮'],
  ['chou', '抽'],
  ['chūn', '春'],
  ['chun', '春'],
  ['cāo', '操'],
  ['cao', '操'],
  ['dàng', '荡'],
  ['dòng', '洞'],
  ['hún', '魂'],
  ['hun', '魂'],
  ['huò', '惑'],
  ['huo', '惑'],
  ['hou', '厚'],
  ['huā', '花'],
  ['hua', '花'],
  ['jiao', '交'],
  ['jiāo', '交'],
  ['jīng', '精'],
  ['jing', '精'],
  ['jǐng', '警'],
  ['jian', '奸'],
  ['jī', '激'],
  ['ji', '激'],
  ['lù', '露'],
  ['lu', '露'],
  ['luo', '裸'],
  ['mí', '迷'],
  ['mén', '门'],
  ['mo', '摸'],
  ['nv', '女'],
  ['qing', '情'],
  ['rén', '人'],
  ['rì', '日'],
  ['rǔ', '乳'],
  ['ru', '乳'],
  ['sè', '色'],
  ['se', '色'],
  ['si', '死'],
  ['she', '射'],
  ['shè', '射'],
  ['sāo', '搔'],
  ['sao', '搔'],
  ['tǐng', '挺'],
  ['xiao', '小'],
  ['xìng', '性'],
  ['xing', '性'],
  ['xizàng', '西藏'],
  ['xiong', '胸'],
  ['yao', '药'],
  ['yào', '药'],
  ['yin', '淫'],
  ['yīn', '阴'],
  ['yín', '淫'],
  ['yù', '运'],
  ['yu', '欲'],
  ['zhōngyāng', '中央']
];

export default function Arrange ({ title, content }: { title: string, content: string }) {
  content = clear.reduce<string>((txt, reg) => txt.replace(reg, ''), content);
  content = replace.reduce<string>((txt, [org, target]) => txt.replace(new RegExp(org, 'g'), target), content);
  console.info(`《${title}》整理完成，共${content.length}字`);
  return { content, title };
}
